<template>
	<view>
		<view class="formlist inputtext">
			<view class="formgroup border-bottom-E3E3E5">
				<view class="labletitle" v-if="showLabel">
					<label>{{label}}</label>
					<text class="required" v-if="required">*</text>
				</view>
				<view class="controlvalue">
					<input type="text" :disabled="disabled" :maxlength="maxlength"
					 :placeholder="placeholder" v-model="valueTitle" v-if="type == 'comInput'" @input="input">
					 
					<input type="number" :disabled="disabled" :maxlength="maxlength"
					  placeholder="请输入数字" v-model="valueTitle" v-if="type == 'numInput'" @input="input">
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			value: '',
			disabled:{
				type:Boolean,
				default(){
					return false
				}
			},
			type:{
				type:String,
				default(){
					return ''
				}
			},
			maxlength:{
				type:Number,
				default(){
					return 50
				}
			},
			placeholder:{
				type:String,
				default(){
					return '请输入'
				}
			},
			showLabel:{
				type:Boolean,
				default(){
					return true
				}
			},
			required:{
				type:Boolean,
				default(){
					return false
				}
			},
			label:{
				type:String,
				default(){
					return '控件标题'
				}
			},
			tableModel:{
				type:String,
				default(){
					return ''
				}
			},
			
		},
		data() {
			return {
				controlProerty:{
					maxlength:20
				},
				valueTitle:''
			};
		},
		created() {
			
			// if(this.value == undefined){
			// 	this.valueTitle = null;
			// }
			
		},
		methods:{
			input(e){
				this.valueTitle = e.detail.value;
				this.$emit('input',this.valueTitle);
				// this.$forceUpdate();
			}
		},
		watch:{
			/* 监听值的改变 */
			value(val){
				
				this.valueTitle = val
			}
		}
	}
</script>

<style>
	.required{
		color: red;
	}
</style>
